//== SAGITTARIUS ============================================================================

//== FILEDOC =========================================================================

/** @file lexx.h
  * @brief The lexer
  * @details Contains procedures for constructing DFAs for parallel matching of regular
  * expressions
  * 
  * @page LexerCmdLang "Lexer Command Language"
  * The Lexer Command Language is used to specify the design of a DFA for patten matching <br>
  * <br>
  * @ref LexerBNF "Formal Syntax"
  */

//== BEGINNING OF CODE ===============================================================

#ifndef __SAGUTTARUIS__LEXX__H_
#define __SAGUTTARUIS__LEXX__H_

//== INCLUDES ========================================================================

#include "sagittarius/core/SagittariusCore.h"
#include "sagittarius/lexer/lAST.h"
#include "sagittarius/lexer/lParser.h"
#include "sagittarius/lexer/lexsymtab.h"
#include "sagittarius/lexer/treewalk.h"
#include "sagittarius/lexer/lexvec.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct __lex_nodeLink {
    struct __lex_nodeLink* next;
    lASTNode* n;
} lex_nodeLink;

typedef struct {
    lsymtab tab;
    lparserState ps;
    uint32 error;
    lex_nodeLink* base;
    lparserInfo pi;
    
    ///@brief Vector containing the program
    lexvec* v;
    ///@brief Vector items with actions
    lexvec* v2;
    ///@brief Variables
    lexvar* var;
    ///@brief Number of variables
    size_t nv;
} lexWork;

void finalize_lex(lexWork* lw);

lexWork* golex(constLexBuf buf);

#ifdef __cplusplus
}//extern "C"
#endif

#endif
